script_enemy_main {
	let csd		=GetCurrentScriptDirectory;
	let shotData	=csd ~ "shot.txt";
	let imgEy	=csd ~ "img\yosei1.png";
	let imgmh	=csd ~ "img\mh.png";
	let imgmhjn	=csd ~ "img\mhjn.png";
	let tama	=csd ~ "img\tama.wav";
	let po		=GetArgument[0];
	let f1		=GetArgument[1];
	let f2		=GetArgument[2];
	let f3		=GetArgument[3];
	let dr		=0;
	let drsign	=1;
	let C		=90;

    @Initialize {
        SetLife(20);
	SetDamageRate(100, 100);
	SetScore(1000);
	LoadGraphic(imgEy);
	LoadGraphic(imgmh);
	LoadGraphic(imgmhjn);
	LoadUserShotData(shotData);
	SetTexture(imgEy);
	LoadSE(tama);
	TMain;
	}

    @MainLoop {
    	if(GetX<=0 || GetX>=448){VanishEnemy;}
	if(GetY<=-72 || GetY>=496){VanishEnemy;}
        SetCollisionA(GetX, GetY, 16);
        SetCollisionB(GetX, GetY, 8);
	yield;
	}

	@DrawLoop
	{
	SetGraphicRect(0,0,64,64);
	SetGraphicAngle(0,0,0);
	SetColor(255,255,255);
	SetTexture(imgmh);
	DrawGraphic(GetX,GetY);
	dr+=drsign;
	if(dr>=0 && dr<=3){SetGraphicRect(0,0,31,31);}
	else if(dr>=4 && dr<=10){SetGraphicRect(32,0,63,31);}
	else {SetGraphicRect(64,0,95,31);}
	if(dr>=10){drsign=-drsign;}
	if(dr<=0){drsign=-drsign;}
	SetGraphicAngle(0,0,0);
	SetColor(255,255,255);
	SetTexture(imgEy);
	DrawGraphic(GetX,GetY);
	SetGraphicRect(0,0,64,64);
	SetGraphicAngle(0,0,GetAngleToPlayer-90);
	SetColor(255,255,255);
	SetTexture(imgmhjn);
	DrawGraphic(GetX,GetY);
	}
	@Finalize{
	attributeB();
	}

    task TMain {
        yield;
IDOUA;
wait(60);
loop(3){
shotA;
wait(40);
}
}


sub shotA {
let B=GetAngleToPlayer-90;
let A=3;
loop(6){
loop(2){
CreateShot01(GetX+cos(B)*6,GetY+sin(B)*6,A,GetAngleToPlayer,62,0);
B+=180;
}
CreateShot01(GetX+cos(B)*6,GetY+sin(B)*6,A,GetAngleToPlayer+30,62,0);
CreateShot01(GetX+cos(B+180)*6,GetY+sin(B+180)*6,A,GetAngleToPlayer-30,62,0);
A+=0.15;
}

}

task IDOUA{
loop(f3){
yield;
SetSpeed(GetSpeed);
SetAngle(GetAngle+sin(C)*f1);
C+=f2;
}
}


function wait(w) {
    loop(w) { yield; }
}
#include_function ".\zako.txt"
}